@extends('admin.layout')
@section('content')
  <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
               商家管理
                <small>列表</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 后台</a></li>
                <li><a href="#">商家管理</a></li>
                <li class="active">列表</li>
            </ol>
        </section>
        
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">快速查看商家列表</h3>
                        </div><!-- /.box-header -->
                        <div class="box-body">
                            @if(session('info'))
                            <div id="showHidden" class="alert alert-success alert-dismissable">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <h4>    <i class="icon fa fa-check"></i> Alert!</h4>
                                {{session('info')}}
                            </div>
                            @endif

                            <script type="text/javascript">
                                window.onload = function()
                                {
                                   $("#showHidden").hide(3000);
                                }
                            </script>
                            <form action="{{url('admin/businesses/index')}}" method="get">
                                <div class="row">
                                    <div class="col-md-4">
                                        <div class="form-group">
                                            <select name="num" class="form-control">
                                                <option value="1" 
                                                @if(!empty($request['num'])&& $request['num']==1) 
                                                    selected="selected"
                                                @endif
                                                >1</option>
                                                <option value="2"
                                                @if(!empty($request['num'])&& $request['num']==2) 
                                                    selected="selected"
                                                @endif
                                                >2</option>
                                                <option value="3"
                                                @if(!empty($request['num'])&& $request['num']==3) 
                                                    selected="selected"
                                                @endif
                                                >3</option>
                                                <option value="5"
                                                @if(!empty($request['num'])&& $request['num']==5) 
                                                    selected="selected"
                                                @endif

                                                >5</option>
                                                <option value="10"
                                                @if(!empty($request['num'])&& $request['num']==10) 
                                                    selected="selected"
                                                @endif
                                                >10</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-md-offset-2">
                                        <div class="input-group input-group">
                                            <input class="form-control" type="text" value="{{$request['keyword'] or ''}}" name = "keyword">
                                            <span class="input-group-btn">
                                              <button class="btn btn-info btn-flat" >搜索</button>
                                            </span>
                                        </div>
                                    </div>
                                </div> 
                            </form>   
                            <table id="example2" class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>商家名称</th>
                                        <th>图片</th> 
                                        <th>地址</th> 
                                        <th>手机</th>
                                        <th>邮箱</th>
                                        <th>状态</th>
                                        <th>描述</th>

                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    
                                    @foreach($data as $goods)
                                    <tr>
                                        <td id="ids">{{$goods -> id}}</td>
                                        <td name="username">{{$goods -> username}}
                                        </td>
                                        <td><img width="80px"src="{{$goods -> img}}"/></td>
                                        <th>{{$goods -> business_address}}</th> 
                                        <td>{{$goods -> phone}}</td>
                                        <td>{{$goods -> email}}</td>
                                        <td class="lang">
                                            @if($goods -> status == '0')
                                                营业
                                            @else
                                                休息
                                            @endif
                                        </td>
                                        <th class="col-md-3">{!!$goods -> des!!}</th>
                                        <td class="col-md-1"><a href="{{url('/admin/businesses/edit')}}/{{$goods -> id}}">编辑</a> <a href="{{('/admin/businesses/delete')}}/{{$goods -> id}}">删除</a></td>
                                    </tr>
                                    @endforeach
                                </tbody>
                            </table>
                            {!! $data-> appends($request) -> render() !!}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->

                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <!-- page script -->

  
@endsection